; tpre3.g
; called before tool 3 is selected

var gridCompensationOn =0
if move.compensation.file != null
    set var.gridCompensationOn =1
    G29 S2

M568 P3 A2

;Unlock Coupler
M98 P"/macros/Coupler - Unlock"

;Move to Y safe position
if move.axes[1].userPosition>175 && move.axes[0].userPosition<150
    G1 Y150 F50000
    M400

;Move to location
G1 X{global.T3parkX} Y200 F50000

;Move in
G1 X{global.T3parkX} Y230 F50000

;Collect
G1 X{global.T3parkX} Y{global.T3parkY} F2500

;Close Coupler
M98 P"0:/macros/Coupler - Lock"

;WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
;if you are using non-standard length hotends ensure the bed is lowered enough BEFORE undocking the tool!
if !move.axes[2].homed
    M564 H0

G91
G1 Z10 F1000
G90

if !move.axes[2].homed
    M564 H1

if heat.heaters[3].current > heat.coldExtrudeTemperature
    G11
    G10

;Move Out
G1 X{global.T3parkX} Y150 F12000
if var.gridCompensationOn =1
    G29 S1
